<template>
  <div class="login-container">
    <div class="login-card">
      <div class="brand-area">
        <div class="logo">
          <svg viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg">
            <path d="M24 44C35.0457 44 44 35.0457 44 24C44 12.9543 35.0457 4 24 4C12.9543 4 4 12.9543 4 24C4 35.0457 12.9543 44 24 44Z" fill="#409EFF" stroke="#409EFF" stroke-width="2"/>
            <path d="M24 12V36" stroke="white" stroke-width="4" stroke-linecap="round"/>
            <path d="M36 24H12" stroke="white" stroke-width="4" stroke-linecap="round"/>
          </svg>
        </div>
        <h1 class="brand-name">臻品甄选</h1>
        <p class="brand-subtitle">管理系统</p>
      </div>

      <el-form :model="form" label-width="auto" style="max-width: 600px">
        <el-form-item label="用户账号:">
          <el-input v-model="form.username" size="large" />
        </el-form-item>

        <el-form-item label="密码:" >
          <el-input v-model="form.password" size="large" type="password"/>
        </el-form-item>



        <el-form-item>
          <el-button type="primary" @click="onSubmit">登录</el-button>
        </el-form-item>
      </el-form>

      <div class="footer">
        <p class="copyright">©2023 真品甄选 版权所有</p>
        <p class="version">v1.0.0</p>
      </div>
    </div>
  </div>
</template>

<script setup>
import { ref } from 'vue'
import { useRouter } from 'vue-router';
import axios from "axios";
import {ElMessage} from "element-plus";
const router = useRouter()

const form = ref({
  username:"admin",
  password:"123456"
})

const onSubmit = () => {
  axios({
    url:"/api/menu/user/login",
    method:"post",
    data:form.value
  }).then((rew)=>{
    router.push("/main")
    ElMessage.success('登录成功')
  })


}


</script>

<style scoped>
.login-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #f0f7ff 0%, #e0f0ff 100%);
  padding: 20px;
}

.login-card {
  width: 100%;
  max-width: 420px;
  padding: 40px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 120, 255, 0.1);
  transition: all 0.3s ease;
}

.login-card:hover {
  box-shadow: 0 15px 35px rgba(0, 120, 255, 0.15);
}

.brand-area {
  text-align: center;
  margin-bottom: 36px;
}

.logo {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  width: 64px;
  height: 64px;
  margin-bottom: 16px;
  border-radius: 16px;
  background: #ecf5ff;
}

.logo svg {
  width: 36px;
  height: 36px;
}

.brand-name {
  font-size: 24px;
  font-weight: 600;
  color: #303133;
  margin: 0;
  line-height: 1.4;
}

.brand-subtitle {
  font-size: 14px;
  color: #909399;
  margin: 4px 0 0;
}

.login-form {
  margin-top: 10px;
}

:deep(.el-input__wrapper) {
  border-radius: 8px;
  padding: 1px 15px;
  box-shadow: 0 0 0 1px #dcdfe6 inset;
  transition: all 0.3s;
}

:deep(.el-input__wrapper.is-focus) {
  box-shadow: 0 0 0 1px #409EFF inset !important;
}

.login-btn {
  width: 100%;
  border-radius: 8px;
  height: 48px;
  font-size: 16px;
  font-weight: 500;
  letter-spacing: 1px;
  background-color: #409EFF;
  border: none;
  transition: all 0.3s;
}

.login-btn:hover {
  background-color: #66b1ff;
  transform: translateY(-2px);
}

.login-btn:active {
  transform: translateY(0);
}

.footer {
  margin-top: 32px;
  text-align: center;
}

.copyright {
  font-size: 12px;
  color: #c0c4cc;
  margin: 8px 0;
}

.version {
  font-size: 12px;
  color: #e6e8eb;
  margin: 8px 0;
}
</style>